<?php

use yii\helpers\Html;
use yii\widgets\DetailView;

/* @var $this yii\web\View */
/* @var $model common\models\User */

$this->title = $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Users', 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="user-view">
    <br>
    <p>
        <?= Html::a('更新', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
        <?= Html::a('删除', ['delete', 'id' => $model->id], [
            'class' => 'btn btn-danger',
            'data' => [
                'confirm' => '你确定要删除吗?',
                'method' => 'post',
            ],
        ]) ?>
    </p>

    <?= DetailView::widget([
        'model' => $model,
        'attributes' => [
            'id',
            'name',
            'password',
            'phone',
            'site',
            [
                'attribute'=>'imageFile',
                'format' => ['image',['width'=>'80','height'=>'80',]],
                'value' => function($data){
                    return 'http://admin.demo.com/'.$data->imageFile;
                }
            ],
            'create_time',
            'last_login_time',
            'last_login_ip',
            [
                'attribute'=>'status',
                'value'=>function($data){
                    return $data->status == 1 ? '已启用' : '已禁用';
                }
            ],
        ],
    ]) ?>

</div>
